<?php
$mag = '开户成功';
$url = 'adminInfo.php';
$AccountCode = $_POST['AccountCode'];
$AccountPhone = $_POST['AccountPhone'];
$RealName = $_POST['RealName'];
 include_once '../tools/DbTools.php';
 DbTools::InitDb();
    $sql = "select *from accountinfo where AccountCode='$AccountCode'";
    $date = DbTools::select($sql);
        if(empty($date)){
            $mag = '开卡失败,身份信息有误或已开户';
            $url = 'Newuser.php';
        }
   else{
 $sql = "insert into accountinfo(AccountCode,AccountPhone,RealName,OpenTime) values('$AccountCode','$AccountPhone','$RealName',NOW())";
        DbTools::noSelect($sql);

    }
 DbTools::close();
    ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
<input type="hidden" id="newUrl" value="<?php echo $url;?>">
<input type="hidden" id="msg" value="<?php echo $mag;?>">
</body>
<script>
    onload = function () {
        var newUrl = document.getElementById('newUrl').value;
        var msg = document.getElementById('msg').value;
        alert(msg);
        location.href = newUrl;
    }
</script>

</html>
